<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户信息</title>
</head>
<script src="http://47.106.66.89:8080/js/vue.min.js"></script>
<script src="js/axios.min.js"></script>
<link href="http://47.106.66.89:8080/js/ele-2.15.7/theme-chalk/index.css" rel="stylesheet">
<script src="http://47.106.66.89:8080/js/ele-2.15.7/index.js"></script>
<body>
<div id="app">
    <div class="activity" style="margin-left:50px ">
        <h1>用户信息</h1>

        <el-form style="display: flex" :model="form" label-width="80px" ref="form">
            <el-form-item label="用户名">
                <el-input  style="width: 200px" v-model="form.name"></el-input>
            </el-form-item>
            <el-form-item label="手机号">
                <el-input style="width: 200px" v-model="form.phone"></el-input>
            </el-form-item>
            <el-form-item label="邮箱">
                <el-input style="width: 200px" v-model="form.email"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button @click="onSubmit" type="primary">查询</el-button>
            </el-form-item>
        </el-form>
    </div>

    <div>
        <template>
            <el-table
                    :data="users"
                    style="width: 100%"
                    max-height="800">
                    height="250">
                <el-table-column
                        fixed
                        prop="username"
                        label="用户名"
                        width="150">
                </el-table-column>
                <el-table-column
                        prop="user_account"
                        label="用户账号"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="gender"
                        label="性别"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="phone"
                        label="手机号"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="email"
                        label="邮箱"
                        width="160">
                </el-table-column>
                <el-table-column
                        prop="create_time"
                        label="创建时间"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="update_time"
                        label="更新时间"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="user_role"
                        label="角色"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="tags"
                        label="标签"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="sign"
                        label="个性签名"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="birthday"
                        label="生日"
                        width="120">
                </el-table-column>
                <el-table-column
                        fixed="right"
                        label="操作"
                        width="120">
                    <template slot-scope="scope">
                        <el-button
                                @click="dongjie"
                                type="text"
                                size="small">
                            {{value}}
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>
        </template>
    </div>

</div>

<script>
    var v = new Vue({
        el : "#app",
        data : {
            form: {
                name: '',
                phone: '',
                email: '',
            },
            users: [],
            value:'冻结',
        },
        created() {
            axios.get("/user/user/getUsers").then(res=>{
                this.users = res.data;
            })
        },
        methods : {
            onSubmit(){
                axios.get("/user/user/findUser",{
                    params: {
                        name: this.form.name,
                        phone: this.form.phone,
                        email: this.form.email
                    }
                }).then(res=>{
                    this.users = res.data;
                })
            },
            dongjie(){
                axios.post("/user/user/dongjie").then(res => {
                    if (res.data.code == 1) {
                        this.$message({
                            message: '编辑成功',
                            type: 'success'
                        });
                    }else{
                        this.$message.error('更新失败');
                    }
                });
            }
        }
    })
</script>
</body>
</html>